//
//	 ______    ______    ______    
//	/\  __ \  /\  ___\  /\  ___\   
//	\ \  __<  \ \  __\_ \ \  __\_ 
//	 \ \_____\ \ \_____\ \ \_____\ 
//	  \/_____/  \/_____/  \/_____/ 
//
//	Powered by BeeFramework
//
//
//  ShopBoard.m
//  Pizza
//
//  Created by sendInfo on 2015-03-26.
//  Copyright (c) 2015年 sendInfo. All rights reserved.
//

#import "ShopBoard.h"
#import "ShopDetailBoard.h"

#pragma mark -



@interface ShopBoard()
{
	//<#@private var#>
}
@end

@implementation ShopBoard

SUPPORT_AUTOMATIC_LAYOUT( YES )
SUPPORT_RESOURCE_LOADING( YES )

- (void)load
{

}

- (void)unload
{
}

#pragma mark - Signal

ON_CREATE_VIEWS( signal )
{
    
    


    NSDictionary *dic = @{@"shopId":self.sp.id,@"token":[SendIFAPPDefault shareAppDefault].userToken};
    self.MSG(HttpAPI.shop_home).INPUT(@"body",dic);

    
}

ON_DELETE_VIEWS( signal )
{
}
ON_LOAD_DATAS(signal)
{

    

}
ON_LAYOUT_VIEWS( signal )
{
}

ON_WILL_APPEAR( signal )
{
}

ON_DID_APPEAR( signal )
{
    
}

ON_WILL_DISAPPEAR( signal )
{
    
}

ON_DID_DISAPPEAR( signal )
{
}
ON_SIGNAL3(ShopBoard, back, signal)
{

    [self.stack popBoardAnimated:YES transitionType:BeeUITransitionTypeCube];

}
ON_SIGNAL3(ShopBoard, menuclick, signal)
{

    ShopDetailBoard *listg = [[ShopDetailBoard alloc] init];
    listg.sp = self.sp;
    [self.stack pushBoard:listg animated:YES];

}
ON_MESSAGE3(HttpAPI, shop_home, msg)
{

    if (msg.sending) {
        
       
        
    }else{
    
    
        Status *sta = msg.GET_OUTPUT(@"status");
        if (msg.succeed) {
            
            Shop *spp = msg.GET_OUTPUT(@"shop");
            $(self).FIND(@"advword").DATA(spp.slogan);
            
            $(self).FIND(@"shoptitle").DATA(spp.title);
            
            [self.bg GET:[NSString stringWithFormat:@"%@/%@",[HttpRequest sharedInstance].imageUrl,spp.shop_style.pic] useCache:YES placeHolder:[UIImage imageNamed:@"sorebg"]];
            
            
        }else if (msg.failed){
        
            if ([sta.code intValue] != 10000) {
                
                [self presentFailureTips:sta.message];
            }
        
        }
    
    }


}
@end
